package zhtt;

import org.hibernate.Session;
import org.junit.Test;

/**
 * Created by zhtt on 2017/4/10.
 */
public class StudentMainTest {
    @Test
    public void save(){
        Student03 student=new Student03("zhang san",20,20);
        Session session=HbnUtil.getSession();
        try{
            session.beginTransaction();
            session.save(student);
            session.getTransaction().commit();
            System.out.println(student.getId());
        }catch (Exception e){
            e.printStackTrace();
            session.getTransaction().rollback();
        }
    }
}
